import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'


//vant 按需引入组件样式
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from '@vant/auto-import-resolver';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [
        //配置elementPlus采用sass样式配色系统
        //ElementPlusResolver({ importStyle: "sass" }),
        VantResolver(),
      ],
    }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  css: {
    preprocessorOptions: {
      scss: {
        //自动导入scss文件
        additionalData: ``
        // `
        //     @use "@/styles/element/index.scss" as *;
        //     @use "@/styles/var.scss" as *;
        //   `,
      }
    }
  } ,
  //服务器
  server: {
    open: true,
    // host: '0.0.0.0',
    // port: 8080,
  },
})
